#include "stm32f10x.h"                  // Device header
#include "OLED.h"
#include "W25Q64.h"

uint8_t ArrayWrite[256] = { 0 };
uint8_t ArrayRead[256] = { 0 };
uint8_t i = 0;

int main(void)
{
	OLED_Init();
	W25Q64_Init();
	OLED_ShowString(1, 1, "Hello Bird!");
	OLED_ShowString(2, 1, "MID");
	OLED_ShowString(2, 8, "DID");
	OLED_ShowString(3, 1, "W");
	OLED_ShowString(4, 1, "R");

	W25Q64_GetID();
	OLED_ShowHexNum(2, 5, W25Q64_MID, 2);
	OLED_ShowHexNum(2, 12, W25Q64_DID, 4);

	W25Q64_SectorErase(0x000000);
	ArrayWrite[0] = 0x22;
	ArrayWrite[1] = 0x33;
	ArrayWrite[2] = 0x44;
	ArrayWrite[3] = 0x55;
	W25Q64_PageProgram(0x000000, ArrayWrite, 4);

	for (i = 0; i < 4; i++)
	{
		OLED_ShowHexNum(3, 3 + i * 3, ArrayWrite[i], 2);
	}

	W25Q64_ReadData(0x000000, ArrayRead, 4);
	for (i = 0; i < 4; i++)
	{
		OLED_ShowHexNum(4, 3 + i * 3, ArrayRead[i], 2);
	}
	while (1)
	{

	}
}
